Pharmacy pill counting vision system

ABSTRACT

A semi-automated pill counting system ( 10 ) using digital imaging technology and image recognition software including a modified Hough Transform. The system ( 10 ) comprises a light source ( 12 ); a modified pharmacist&#39;s tray ( 14 ); a digital camera ( 16 ); and a personal computer (PC) ( 18 ), with the PC ( 18 ) storing and executing the image recognition software. A roughly estimated number of pills are placed upon the tray ( 16 ) and illuminated by the light source ( 12 ), whereafter a digital image of the pills is produced by the camera ( 16 ) and sent via an interface to the PC ( 18 ). The image recognition software counts the pills present in the image and displays a count result. Based upon the count result, the pharmacist adds or removes pills to the tray ( 14 ), as appropriate, to complete the process.

RELATED APPLICATIONS

[0001] The present application relates to and claims priority withregard to all common subject matter of provisional patent applicationtitled “Computer Interfaced Camera For Counting Drug Units Such AsPills”, Serial No. 60/181,979, filed Feb. 11, 2000. The identifiedprovisional patent application is hereby incorporated into the presentapplication by reference. Further, the present application is acontinuation of non-provisional patent application entitled “PharmacyPill Counting Vision System,” Ser. No. 09/779,290, filed Feb. 8, 2001,and is hereby incorporated into the present application by reference.

COMPUTER PROGRAM LISTING APPENDIX

[0002] A computer program listing appendix containing the source code ofa computer program that may be used with the present invention isincorporated herein by reference from non-provisional patent applicationentitled “Pharmacy Pill Counting Vision System,” Ser. No. 09/779,290,filed Feb. 8, 2001. The source code incorporated by reference is listedas follows: Filename: Date of Creation: Size (Bytes): COLORL˜1.CPP Jan.26, 2001 7,307 IMAGEA˜1.CPP Jan. 26, 2001 17,568 PCA_DLG.CPP Jan. 26,2001 20,654 PERIME˜1.CPP Jan. 26, 2001 17,797 PERIME˜2.CPP Jan. 26, 200130,714 PILLLIST.CPP Jan. 26, 2001 61,258

BACKGROUND OF THE INVENTION

[0003] 1. Field of the Invention

[0004] The present invention relates to automated and semi-automatedpill counting systems. More particularly, the invention relates to asemi-automated pill counting system using digital imaging technology andimage recognition software.

[0005] 2. Description of the Prior Art

[0006] Prescriptions are being issued at an ever-increasing rate due toa number of factors, including managed care's focus on prescriptions asan alternative to inpatient care; an aging population; and increasedconsumer knowledge due, in large part, to direct-to-consumeradvertising. Dispensed prescriptions are projected to reach threebillion in 2001 and jump to four billion annually by 2004, with only asix percent increase in the number of graduating pharmacists over thesame time period. As prescription volume and workload increases, thepotential for error by overworked pharmacists increases as well, whichhas the undesirable effect of reducing patient confidence and overallsafety. Furthermore, given the number of prescriptions dispensed and theaverage cost of each pill, even small error rates can result in largefinancial losses to both the pharmacist and the consumer.

[0007] Traditional manual pill counting methods involve pouring aroughly estimated quantity of pills onto a tray; sliding the pills froma first side of the tray to a second side in small, easily countablegroups; and repeating until a desired pill count is reached, whereuponthe pills are bottled and labeled for dispensation. As will beappreciated by those in the pharmacological arts, though suited forsmall pill counts or low numbers of prescriptions, these traditionalmethods are inefficiently time consuming for large pill counts or highvolume dispensing.

[0008] Another drawback of time-consuming manual pill counting is thatthe more time a pharmacist spends counting pills, the less time he orshe has available for direct patient contact and care, includingeducating the patient about the prescribed medicine. This isparticularly unappealing to pharmacists who are unsatisfied countingpills after years of schooling and training, and would much prefer moremeaningful direct interaction with their customers.

[0009] Sophisticated and efficient fully automated pill counting systemsexist that are able to handle the mundane, repetitive counting functionwithout significant error while freeing the pharmacist for morestimulating and rewarding activities. The SP200 system, manufactured andsold by ScriptPro LLC, for example, can dispense sixty or moreprescriptions per hour, potentially freeing four or more pharmacistsfrom full time counting duties. Furthermore, patient wait times arereduced even as their wait is made more productive by increased directcontact with their pharmacist.

[0010] Unfortunately, fully automated pill counting systems aretypically not cost-effective for small pharmacies, so a need has arisenfor smaller, semi-automated pill counting apparatuses. Such apparatusesuse a variety of counting technologies. One existing technology, forexample, first weighs a group of pills and then determines their numberbased upon an average pill weight. Unfortunately, this relativelyprimitive method is unacceptably error prone due to factors such asincorrect average pill weights, weight-altering residue on the scales orequipment, incorrect calibration, and pill manufacturing changes thataffect pill weight. Furthermore, accurate dosing of a pill's activeingredient does not necessarily translate into consistent combinedactive and inactive ingredient weight from pill to pill.

[0011] Another existing technology couples a light beam and a simplephotosensor with a counter such that when a falling or moving pillbreaks the light beam the counter is incremented. Unfortunately, theseunsophisticated systems are typically unable to discriminate betweenbroken pill fragments and whole pills, or close clusters of two or threepills that break the light beam overlappingly or almost simultaneously.

[0012] Due to the above-described and other problems in the art ofautomated pill counting, a need exists for an improved pill countingtechnology and apparatus.

SUMMARY OF THE INVENTION

[0013] The present invention solves the above-described and otherproblems and provides a distinct advance in the art of pill counting.More specifically, the present invention is a semi-automated pillcounting system using digital imaging technology and image recognitionsoftware to facilitate more efficient, accurate, and cost-effective pillcounting, thereby freeing the pharmacist from this mundane task toengage in more meaningful and direct customer interactions.

[0014] The preferred system comprises a light source; a modifiedpharmacist's tray; a digital camera; and a personal computer (PC), withthe PC storing and executing image recognition software. The lightsource provides light of a sufficient quality and intensity to ensureaccurate counts. The camera is a conventional digital camera securelymounted over a work surface and coupled with the PC via an interface.The pharmacist's tray provides an area upon which uncounted pills may beplaced for viewing by the camera. The work surface includes featuresensuring that the tray is consistently centered. The PC is aconventional personal computer with sufficient computing resources tostore and execute the image recognition software. The PC also provides auser interface with the counting software. In another embodiment,depending upon design and application requirements, the imagerecognition software is stored and executed on dedicated hardware orfirmware, which allows for a unitized or portable device. The preferredimage recognition software is based upon a modified Hough Transformtechnique.

[0015] For example, given a prescription for eighty pills, a pharmacistfirst pours onto the tray a number of pills estimated to be sufficientto fill the prescription. Using the traditional pill counting method,the pharmacist would then manually count out eight groups of ten orsixteen groups of five. Using the present system, however, thepharmacist merely causes the digital camera to produce a digital imageof the actual number of pills on the tray, whereupon the image is sentvia the interface to the PC. The image recognition software executed bythe PC counts the pills in the image; determines the number of pills, ifany, that must be added or removed to arrive at the prescribed amount;and communicates that number to the pharmacist. For example, ifeighty-seven pills are counted, the software instructs the pharmacistthat seven pills should be removed and then verifies that the correctnumber remain. Thus, using the present invention, the pharmacist needperform only two steps rather than eight or sixteen or more. Less timeis spent counting pills and more time is spent interacting with thecustomer. Furthermore, fewer counting errors are made, thereby reducinghealth risks and financial losses.

[0016] These and other novel features of the present invention aredescribed in more detail in the section titled DETAILED DESCRIPTION OF APREFERRED EMBODIMENT, below.

BRIEF DESCRIPTION OF THE DRAWING FIGURES

[0017] The present invention is described in detail below with referenceto the attached drawing figures, wherein:

[0018]FIG. 1 is an isometric view of a preferred system for implementingthe present invention;

[0019]FIG. 2 is a preferred embodiment of a pharmacist's tray shown inFIG. 1 as part of a preferred system; and

[0020]FIG. 3 is a flow diagram showing the steps in a preferred methodof practicing the present invention.

DETAILED DESCRIPTION OF A PREFERRED EMBODIMENT

[0021] Referring to FIG. 1 a semi-automated pill counting system 10 isshown constructed in accordance with a preferred embodiment of thepresent invention and operable to facilitate more efficient and accuratepill counting. The preferred system 10 broadly comprises a light source12; a modified pharmacist's tray 14; a digital camera 16; and a personalcomputer (PC) 18, with the PC 18 storing and executing image recognitionsoftware.

[0022] The light source 12 provides for an evenly and well lit worksurface using light of at least the minimum quality and brightnessrequired by the digital camera 16 and image recognition software toachieve accurate pill counts. Thus, though the present invention isindependent of any particular type or brand of light or bulb, a minimumdegree of light quality and brightness will be necessary and desirabledepending upon the performance characteristics of other systemcomponents. Preferably, the lighting 12 is located approximatelyeighteen inches above the work surface, which is a compromise betweengood lighting and an open, useable work surface.

[0023] The modified pharmacist's tray 14 is operable to contain a numberof pills within the camera's field of view. The preferred tray 14 has ananti-reflective surface to avoid image interference; has clearly definedand distinct first and second portions 30,32 for uncounted and excesspills, respectively, with only the first portion 30, being approximately8×6 inches, viewable by the camera 16; and is easy to clean so as toprevent contamination of prescriptions. The first and second trayportions 30,32 may be defined and separated by a visual or physicaldivider 34, such as a line or raised ridge. Furthermore, it ispreferable that the first tray portion 30 have a changeable backgroundcolor, possible accomplished with colored inserts, so as to allow forimproved color contrast where colored pills are being counted. It mayalso be desirable to provide a mechanism, such as a small motor, wherebythe tray 14 can be vibrated to ensure even, single-layer distribution ofthe pills to be counted.

[0024] The digital camera 16 is a high quality conventional digitalcamera coupled with the PC 18 via an interface 15 and operable tocapture and digitize images for use by the PC 18. The present system 10is independent of any particular type or brand of digital camera, and avariety of cameras are available, each having different performancecharacteristics, including speed, color accuracy, and resolution, thatmay effect overall performance of the system 10. With the exception ofsome multi-pass cameras, most are of comparable exposure speed. The PCinterface 15 plays a much larger role in camera and system speed, with,for example, an RS-232 interface providing a transfer rate of 115.2kbits/sec and a SCSI interface providing a transfer rate of 80,000kbits/sec. Suitable available interfaces include Ethernet, Firewire, andUSB.

[0025] Color accuracy of the camera 16 is important for algorithmsperforming comparisons with a master image. Furthermore, the countingaccuracy of some such algorithms is negatively affected by even smallvariances in image color quality.

[0026] Minimum resolution of the camera 16, measured in“pixels-per-square-inch”, is limited by such factors as minimum pillsize, lack of distinct pill features, and algorithm requirements. Higherresolution, though perhaps more accurate, may slow the process, though afaster PC or processor may compensate. For example, there is four timesas much data in a 640×480 pixel image than in a 320×240 pixel image.Ultimately, camera speed, interface type, color accuracy, and resolutionchoices are all matters of design tradeoff, with better performancetypically translating into higher cost.

[0027] A suitable and preferred camera 16 is Polaroid's DigitalMicroscope Camera le, having a maximum resolution of 1600×1200 pixels,which, when combined with the preferred 8×6 inch counting area, yieldsan image with 40,000 pixels-per-square-inch resolution. An alternate800×600 resolution can be used (10,000 pixels-per-square-inch) forlarger pills to reduce processing time. The camera 16 is preferablypositioned approximately eighteen inches above the work surface, whichis a compromise between good viewing and an open, useable work area.

[0028] The PC 18 may be any conventional computing device, such as acommonly available personal computer, with sufficient computingresources to store and execute the image recognition software anddisplay count results. Peripheral equipment resources preferably includea display 22, such as a monitor, and one or more input devices 24, suchas a keyboard, keypad, or mouse. A suitable and preferred computerutilizes at least a Pentium II 400 MHz processor, and is available, forexample, from Micron Electronics Incorporated, Dell ComputerCorporation, and Compaq Computer Corporation. Again, the exact physicaland performance characteristics of the PC 18, like other systemcomponents, are matters of design, application, and the requirements ofother components. The well-known tradeoff of performance versus costarises here as well, with faster processing speeds typically costingmore. For example, a very high resolution image will typically require alonger processing time, though this can be offset by a faster processingspeed.

[0029] In another embodiment, depending upon design and applicationrequirements, the PC 18 is eliminated and the image recognition softwareis stored and executed on dedicated hardware or firmware coupled with aninput device, such as a keypad, and a display. This adaptation offersthe advantage of smaller, lighter components and is particularlydesirable, for example, in unitized or portable embodiments of thepresent invention. The processor may be any suitable device or circuitoperable to receive the digital image, execute the image recognitionsoftware, and generate a count result. The display may be any suitabledisplay, such as a light emitting diode (LED) display of liquid crystaldisplay (LCD), for communicating the count result.

[0030] The image recognition software comprises a combination of programcode segments operable to receive the digitized image from the digitalcamera 16, accurately count the number of pills present in the image,and communicate the count to an operator via the PC 18 or other display.A preferred embodiment of the image recognition software, suitable foruse with the above described system and the below described method inimplementing and practicing the present invention, is appended hereto asa computer listing appendix. The software may be stored on any computerreadable memory media, including magnetic or optical, forming a part ofthe PC 18, such as a hard disk drive, or otherwise accessible thereto,such as a floppy disk or CD-ROM. Furthermore, the software may bewritten in any suitable programming language executable by the PC 18,including Assembly, C++, or Java.

[0031] Several types of image recognition algorithms are well-known,ranging from counting pixels to comparing permutations of scaled androtated regions. A sufficiently complex algorithm, for example, exposedto an image of an unknown number of an unknown type of pill, could bothcount the pills and identify the pill type. Such complexity, however,comes at great costs, both in terms of cash outlay for the software andhigh-end supporting hardware, and overall system speed.

[0032] The nature of the present invention, however, lends itself toseveral assumptions that allow for a less complex image recognitionalgorithm. In particular, the controlled, professional pharmacyenvironment in which the system 10 is used allows one to assume, forexample, that the work surface will be clean, evenly well lit, andcontain only pills of a single type, and that the focal distance of thecamera 16 will be fixed and consistent between applications.

[0033] A suitable and preferred algorithm is a variation of the HoughTransform wherein adjustments for scale have been omitted for the sakeof processing speed. The Hough Transform is an image analysis tooldeveloped by Paul Hough and subsequently disclosed in U.S. Pat. No.3,069,654, issued in 1962, which is hereby incorporated by reference.The Hough Transform allows for recognition of global patterns in animage space by recognition of local patterns in a transformed parameterspace. The transform technique can be used to isolate features of aparticular shape within an image, and group collinear or almostcollinear points into image structures. Because it requires that thedesired features be specified in some parametric form, the classicalHough Transform is most commonly used for the detection of regularcurves such as lines, circles, or ellipses, which makes it ideal fordetecting the regular curves of pills.

[0034] An advantage of the Hough transform is that it is tolerant of lowresolution effects, including missing or contaminated data and,particularly, gaps in feature boundary descriptions or unsharp objectboundaries. Another advantage is that, with the aid of anti-aliasingtechniques, it is relatively tolerant of image noise.

[0035] The above described system 10 and image recognition software maybe more generally and broadly viewed as accomplishing a method ofreliably and accurately counting pills with minimal operatorinvolvement. As will be appreciated by those with skill in the art,however, the method may be implemented using any hardware, software, orfirmware or combination thereof, and is not limited to the system andsoftware described herein.

[0036] The preferred method broadly comprises seven steps, as shown inFIG. 2. Additional steps may be added as desired or needed to adapt themethod to particular applications or circumstances without departingfrom the contemplated scope of the present invention. The methoddescription assumes that the system 10, described above, has beeninstalled and configured correctly.

[0037] In step 1, as depicted by box 100, a desired pill quantity ortotal count is provided to the counting software. This may beaccomplished manually, for example, by an operator using a keypad orkeyboard or other input device associated with the PC 18. Alternatively,the prescription may be received electronically and stored in a queue,in which case the PC 18 is provided with the count data automatically.

[0038] In step 2, as depicted in box 102, pill attribute data isprovided to the image recognition software. Relevant pill attributesinclude size, general shape, and color. Such data may be operatorentered using the keypad or keyboard; automatically retrieved, given thepill name, from a pre-existing database; or automatically determinedfrom exposure to a single pill before counting. In a contemplatedembodiment, each bulk pill container includes a scannable bar codeproviding either just the pill name, from which attribute data may bedetermined, or all relevant attribute data. This latter embodiment, whencombined with electronic prescriptions, advantageously allows forautomatically verifying that the scanned pill matches the prescribedpill.

[0039] In step 3, as depicted in box 104, the background color isadjusted for desirable color contrast. As described above, coloradjustment may be accomplished manually by changing colored trayinserts.

[0040] In step 4, as depicted in box 106, the operator pours a roughlyestimated number of pills upon the first tray portion 30 for counting.

[0041] In step 5, as depicted in box 108, the counting process isinitiated causing the digital camera 16 to produce a digital image ofthe pills on the first tray portion 30 and send the image to the PC 18via the interface 15, where it is received by the image recognitionsoftware. The counting algorithm identifies individual pills from theimage and counts them. When the count is complete, a count result iscommunicated by the PC monitor 22 or other display.

[0042] In step 6, as depicted in box 110, if the count result doesmatch, the process ends whereafter excess pills are returned to a bulkcontainer and counted pills are bottled, labeled, and dispensed. If,however, as depicted in box 112, the count result does not match thedesired quantity, pills are added or removed as required. In this lattercase, step 5 may be repeated to confirm that the correct number of pillswere added or removed. In some embodiments, the system 10 affects anautomatic refresh at a pre-established refresh rate so that step 5 willbe automatically periodically repeated until the system 10 is reset orpowered down.

[0043] In another embodiment, the tray 14 or at least the first portion30 thereof is transparent and rests on a horizontally-orientedbackground display (not shown), such as a liquid crystal display orcomputer monitor, or other surface operable to change color in responseto an input or stimulus. In this embodiment, step 3 of theabove-described method, which involves background color-contrasting, maybe affected automatically or semi-automatically. For example, pillcolor, being a pill characteristic, may be retrieved, given the pillname, from a pre-existing database, and the background display changedautomatically to present a contrasting color.

[0044] In this embodiment, it is also contemplated that the imagerecognition software, having counted the pills present in the digitalimage and found an excess, be operable to indicate via the backgrounddisplay which pills to remove from the first tray portion 30 to achievethe desired prescription count. This may be accomplished, for example,either with a moveable line boundary between groups of excess andnon-excess pills, possibly including different background colors oneither side of the line boundary, or individually indicating excesspills for removal, possibly using circles or arrows. Thus, thepharmacist need count no pills whatsoever—he or she need only roughlyestimate the number of pills to place upon or add to the tray 14 andremove any excess to the second tray portion 32 as indicated by thebackground display.

[0045] It should be noted that the image recognition and countingsoftware is not limited to identifying and counting a single type ofpill per program execution. Rather, different quantities of differenttypes of pills may be identified and counted at the same time. This isparticularly important where the pharmacist is engaged in “compliancepackaging”, which involves single dose packaging of a number ofdifferent pills to reduce risks of forgetting to take or having taken adose of one or more of the pills.

[0046] Although the invention has been described with reference to thepreferred embodiment illustrated in the attached drawing figures, it isnoted that equivalents may be employed and substitutions made hereinwithout departing from the scope of the invention as recited in theclaims. Those with skill in the art will appreciate that numerousdifferent embodiments of hardware, software, firmware or combinationsthereof exist for practicing the present invention. For example, asnoted, the system 10 may be unitized or made portable by reducingcomponent size and power requirements; using dedicated hardware orfirmware, such as the disclosed alternate processor and display;combining the components in a single lightweight housing; or affectingother appropriate adaptations. Accordingly, the present invention shouldnot be viewed as limited to the particular illustrative embodiment shownand described.

[0047] Furthermore, the invention may be easily adapted to othercontexts and applications and is not limited to assisting pharmacists incounting pills. Broadly, the invention has application wherever a numberof relatively small items must be quickly and accurately counted andwhere manual counting and relatively large mechanical counting devicesare impractical. For example, a bank or casino may employ the presentinvention at each teller or dealer station to quickly and accuratelycount small quantities of coins or chips. In another example, hardwarestores may employ the present invention to quickly and accurately countan order or purchase of nuts, bolts, or screws. And note, as describedabove in the context of compliance packaging, the present invention isable to identify and count different types of coins or chips or nuts,bolts, and screws simultaneously.

[0048] Having thus described the preferred embodiment of the invention,what is claimed as new and desired to be protected by Letters Patentincludes the following:

1. A system for counting a quantity of pills, the system comprising: apharmacist's tray upon which the quantity of pills may be arranged; adigital camera operable to produce a digital image of the quantity ofpills arranged upon the pharmacist's tray; a processor interfaced withthe digital camera and operable to receive the digital image, execute aprogram to count the number of pills present in the digital image, andgenerate a count result; and a display operable to communicate the countresult.
 2. The system as set forth in claim 1, wherein the program usesan image recognition algorithm based upon a Hough Transform.
 3. Thesystem as set forth in claim 2, wherein the Hough Transform is modifiedin that adjustments of scale are omitted.
 4. The system as set forth inclaim 1, further comprising a light source operable to illuminate thepharmacist's tray.
 5. The system as set forth in claim 1, wherein thepharmacist's tray includes a divided surface on which the pills may beseparated into distinct portions.
 6. The system as set forth in claim 5,wherein the pharmacist's tray further includes a small motor forvibrating the tray to ensure even, single-layer distribution of thepills to be counted.
 7. The system as set forth in claim 1, wherein thepharmacist's tray presents a background surface having a changeablecolor.
 8. The system as set forth in claim 7, wherein removable coloredinserts are used to change the changeable color of the backgroundsurface.
 9. A system for counting a quantity of pills, the systemcomprising: a pharmacist's tray upon which the quantity of pills may bearranged, wherein the pharmacist's tray has a first end and a second endand includes a divided surface, wherein the first end includes a hingedcovered portion, and the second end includes a tapered spout throughwhich the pills may be funneled into a vial; a digital camera operableto produce a digital image of the quantity of pills arranged upon thepharmacist's tray; a processor interfaced with the digital camera andoperable to receive the digital image, execute a program to count thenumber of pills present in the digital image, and generate a countresult; and a display operable to communicate the count result.
 10. Thesystem as set forth in claim 9, wherein the program uses an imagerecognition algorithm based upon a Hough Transform.
 11. The system asset forth in claim 10, wherein the Hough Transform is modified in thatadjustments of scale are omitted.
 12. The system as set forth in claim9, wherein the pharmacist's tray further includes an anti-reflectivesurface to avoid image interference.
 13. The system as set forth inclaim 9, wherein the pharmacist's tray further includes a mechanism forvibrating the tray to ensure single-layer distribution of the pills. 14.A method of counting pills, the pills having one or more visuallyidentifying characteristics, the method comprising: (a) receiving adesired quantity input of pills, wherein the pills are arranged on apharmacist's tray for counting; (b) producing a digital image of thepills; (c) identifying and counting the pills present in the digitalimage based upon the visually identifying characteristics; (d)generating a count result; and (e) displaying the count result.
 15. Themethod as set forth in claim 14, further comprising the step of (f)adjusting a background color of the pharmacist's tray based upon a pillcolor.
 16. The method as set forth in claim 14, further comprising thestep of (f) displaying a number equal to a difference between thedesired quantity input and the count result.
 17. The method as set forthin claim 14, further comprising the step of (f) indicating, when thecount result exceeds the desired quantity input, pills whose removal,based upon the digital image, would cause the count result to equal thedesired quantity input.
 18. A method of counting pills, the pills havingone or more visually identifying characteristics, the method comprising:(a) receiving a desired quantity input; (b) determining the visuallyidentifying characteristics, including a pill color and a pill shape;(c) adjusting a background color of a pharmacist's tray, on which thepills are arranged, based upon the pill color. (d) producing a digitalimage of the pills; (e) identifying and counting the pills present inthe digital image based upon the visually identifying characteristics,and generating a count result; and (f) displaying the count result. 19.The method as set forth in claim 18, wherein step (b) is accomplished byreceiving characteristics input defining the one or more visuallyidentifying characteristics.
 20. The method as set forth in claim 18,wherein step (b) is accomplished by retrieving from a database the oneor more visually identifying characteristics.
 21. The method as setforth in claim 18, wherein step (b) is accomplished by receiving andanalyzing a digital image of a single representative pill.
 22. Themethod as set forth in claim 18, further including the step of (g)displaying a number equal to a difference between the desired quantityinput and the count result.
 23. The method as set forth in claim 18,further comprising the step of (g) indicating, when the count resultexceeds the desired quantity input, pills whose removal, based upon thedigital image, would cause the count result to equal the desiredquantity input.
 24. A system for counting a quantity of items, thesystem comprising: a divided surface upon which the quantity of itemsmay be arranged; a digital camera operable to produce a digital image ofthe quantity of items arranged upon the divided surface; a processorinterfaced with the digital camera and operable to receive the digitalimage, execute a program to count the number of items present in thedigital image, and generate a count result; and a display operable tocommunicate the count result.
 25. The system as set forth in claim 24,the items being selected from the group consisting of: pills, coins,playing chips, fasteners.
 26. A system for counting a quantity ofdifferent types of items, the system comprising: a divided surface uponwhich the quantity of different types of items may be arranged; adigital camera operable to produce a digital image of the quantity ofdifferent types of items arranged upon the divided surface; a processorinterfaced with the digital camera and operable to receive the digitalimage, execute a program to identify and count the number and types ofitems present in the digital image, and generate a count result for eachdifferent type; and a display operable to communicate the count results.27. The system as set forth in claim 26, the items being selected fromthe group consisting of: pills, coins, playing chips, fasteners.